<?php
class ArticleModel extends CommonModel {
	protected $tableName = 'article';
	/* protected $_link = array(
			'article_cat'=>array(
					'mapping_type'=>BELONGS_TO,
					'foreign_key'=>'cat_id',
					'mapping_fields' => 'cat_name'
			),
	); */
	
    // 自动验证设置
    protected $_validate	 =	 array(
        //array('cat_id','require','分类必须！'),
        array('title','require','标题必须！'),
        array('title','','标题已经存在',0,'unique',self::MODEL_BOTH),
    );
    
    // 自动填充设置
    protected $_auto	 =	 array(
        array('add_time','now',self::MODEL_INSERT,'callback'),
        array('edit_time','now',self::MODEL_UPDATE,'callback'),
    );
}

?>